﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web;
using Project.Engine.Utilities;
using Project.Module.DAO.BL;
using Project.Engine.Control;
using Project.Module.Model;

namespace Project.Module.View
{
    public class EventView : BasePageRazor
    {
        public List<EventModel> listEvent = null;
        private EventBL eventBl = new EventBL();

        protected override void InitializePage()
        {
            base.InitializePage();
            GetListEvent();
        }

        private void GetListEvent() {
            this.listEvent = eventBl.GetListEvent();
            if (this.listEvent != null) {
                foreach (var item in this.listEvent) {
                    item.url = StringUtil.UnicodeToKoDauUrl(StringUtil.ShortContent(item.Description, 5));
                    item.ImagePath = eventBl.GetImagePathById(item.ImageID);
                    item.title = StringUtil.ShortContent(item.Description, 5);
                    item.summary = StringUtil.ShortContent(item.Description, 20);
                    item.totalComment = (new FeedBackBL()).GetCommentEvent(item.EventID).ToList().Count;
                }
            }
        }
    }
}
